import { _decorator, CCFloat, Component, Node ,screen, Vec2, Vec3} from 'cc';
const { ccclass, property } = _decorator;

@ccclass('ResizeByScreen')
export class ResizeByScreen extends Component {

    @property(CCFloat)
    public hpSize:number;
    
    @property(CCFloat)
    public spSize:number;

    update(deltaTime: number) {
        if(screen.windowSize.width > screen.windowSize.height){
            this.node.worldScale = new Vec3(this.hpSize,this.hpSize,this.hpSize);
        }
        else
        {
            this.node.worldScale = new Vec3(this.spSize,this.spSize,this.spSize);
        }
    }
}


